import {get, post} from '@/http/axios'

export default {
    namespaced: true,
    state: {
        users: []
    },
    mutations: {
        // 通过突变修改state中user
        refreshQueryUser(state,users) {
            state.users = users
        }
    },
    actions: {
        // 删除
        async deleteUser({commit},id) {
            let response = await get("/baseUser/deleteById",{id})
            return response;
        },
        // 保存更新
        async saveOrUpdateUser({commit},params) {
            let response = await post("/baseUser/saveOrUpdate",params)
            return response;
        },
        // 分页查询用户信息
        async queryUser({commit},params) {
            let response = await get("baseUser/pageQuery",params)
            commit("refreshQueryUser",response.data.data)
        }
    }
}